package com.wctj.api.business.common.manager;

import com.wctj.api.business.common.manager.bo.AdminUserDTO;
import com.wctj.api.business.common.manager.bo.AdminUserDetails;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * @author lzg
 */
@Service
public class UserManager {



    /**
     * 加载用户信息及权限点
     * @param username
     * @return
     */
    public UserDetails loadUserByUsername(String username) {
//        AdminUserDTO adminUserDTO = ddwxAdminUserService.selectByUserName(username);
//        if (Objects.isNull(adminUserDTO)) {
//            throw new CustomException(ApiCode.LOGIN_ERROR,"用户不存在");
//        }

//        List<Long> roleIds = izsUserRoleService.getUserRoleByUserId(adminUserDTO.getId());
//        if (CollectionUtils.isEmpty(roleIds)) {
//            return new AdminUserDetails(adminUserDTO,new ArrayList<>());
//        }
//        // 获取分配的权限
//        List<Long> authIds = izsRoleAuthService.getAuthsByRoleIds(roleIds);
//        List<IzsAuthDTO> auths = izsAuthService.selectByIds(authIds);
        return new AdminUserDetails(new AdminUserDTO()
                .setUn(username).setId(1L),
                new ArrayList<>());
    }


}
